Release 10.1A: OpenEdge Development:
ADM and SmartObjects
SmartSelect usage notes
This section discusses special programming considerations for using SmartSelects.
Event on change instance property
The Event on change property allows you to specify an event to
PUBLISHif the value of a displayed SmartSelect field changes. Doing this, however, entails more than simply specifying an event name; you also must subscribe the SmartSelect’s data source to your new event, define the event, and so on. The following example illustrates how to do this. It assumes you started the AppBuilder and connected to a copy of the Progress sports2000 database.
![]()
To specify an event to PUBLISH if the value of a displayed SmartSelect field changes:
- Create the following SmartObjects:
- Drop the
salesrepSmartDataObject onto the SmartDataViewer.- Drop a SmartSelect onto the
salesrepfield of the SmartDataViewer.- Set the SmartSelect instance properties as follows:
- SmartDataObject: dslsrep.w (the
salesrepSmartDataObject).- Key Field: SalesRep.
- Displayed Field: SalesRep.
- Event on change: SalesRepSelected (you will define this event in a later step).
- View as: Browser.
- Label: Sales Rep.
- Browse Title: Sales Representatives.
- Tooltip: Select Sales Rep for the Order.
For all other instance properties, accept the defaults.
- In the Section Editor, create the following:
- An override procedure for the SmartDataViewer that uses the
initializeObjectprocedure. Note that whether this procedure runs before or after the SmartDataViewer’s standard behavior depends on where you put the code, as the example code illustrates.- A
SUBSCRIBEstatement for your event. (Note thath_dynselectis the SmartSelect object name.)
- Using the Section Editor, create an internal procedure that defines your event; for example:
- Save this procedure with
Name=SalesRepSelected.- Save the SmartDataViewer object as
vcustsls.w.- Create a new SmartWindow, then add the following:
- Save this application as the object
wcustsls.w, then run it.- Choose the Browse icon to view a list of sales-representative names.
- Select the name of a sales representative. A dialog box appears and displays the value that you selected. This dialog box is based on the
SalesRepSelectedprocedure you defined.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |